<template>
  <div>
    <van-nav-bar
      title="个人中心"
      left-text="返回"
      right-text="退出"
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    <span class="sp1">个人中心</span>
    <div class="user">
      <van-nav-bar left-arrow @click="goAddressManges">
        <template #left>
          <span>地址管理</span>
        </template>
        <template #right>
          <van-icon name="arrow" />
        </template>
      </van-nav-bar>
      <van-nav-bar left-arrow @click="goOrderCenter">
        <template #left>
          <span>订单中心</span>
        </template>
        <template #right>
          <van-icon name="arrow" />
        </template>
      </van-nav-bar>
    </div>
  </div>
</template>

<script>
import { checkCartList } from "../service/banner.js";
export default {
  data() {
    return {};
  },
  computed:{
    userInfo() {
      // 提取仓库里面的数据（登录用户消息）
      return this.$store.state.userInfo;
    },
  },
  methods: {
    onClickLeft() {
      history.back();
    },
    onClickRight() {
      localStorage.removeItem("token");
      this.$store.commit("userInfo", {});
      this.$router.push("/login");
    },
    goAddressManges() {
      this.$router.push("/addressManagement");
    },
    goOrderCenter() {
      this.$router.push("/orderCenter");
    },
  },
};
</script>
<style scoped>
.sp1 {
  font-size: 14px;
  color: gray;
  margin-left: 20px;
}
.user {
  margin: 0px 15px;
}
.user > .van-nav-bar:first-child {
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}
.user > .van-nav-bar:nth-child(2) {
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}
</style>
